import yaml
import hashlib
import os

def load_config(config_path):
    """加载YAML配置文件"""
    with open(config_path, 'r', encoding='utf-8') as f:
        return yaml.safe_load(f)

def get_md5(text):
    """生成文本的MD5值"""
    return hashlib.md5(text.encode('utf-8')).hexdigest()

def ensure_dir(directory):
    """确保目录存在，如果不存在则创建"""
    if not os.path.exists(directory):
        os.makedirs(directory) 